package com.yidi.system.repository;

import com.yidi.common.core.Repository.BaseRepository;
import com.yidi.system.domain.SysRoleDept;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;

/**
 * @author ：Xn
 * @ClassName: SysRoleDeptRepository
 * @date ：2021-10-19 14:06
 * @describe ：角色和部门
 */
@Repository
public interface SysRoleDeptRepository extends BaseRepository<SysRoleDept,Long> {

    /**
     * 通过角色ID删除角色和部门关联
     *
     * @param roleId 角色ID
     * @return 结果
     */
    @Modifying
    @Transactional
    @Query(nativeQuery = true, value = "delete from sys_role_dept where role_id = ?1")
    void deleteRoleDeptByRoleId(Long roleId);
}
